import type { ConsultInfo } from "@/types/consult";
import { defineStore } from "pinia";
import { ref } from "vue";

export const useConsultStore = defineStore('consult', () => {
    // 患者病情初始数据
    const initalValue = {
        illnessDesc: '',
        illnessTime: 1,
        consultFlag: 0,
        pictures: [],
    }

    // 定义患者病情数据
    const illnessInfo = ref<ConsultInfo>({ ...initalValue })
    const type = ref('')
    const illnessType = ref('')
    const depId = ref('')
    const patientId = ref('')    // 患者ID
    const clear = () => {
        illnessInfo.value = { ...initalValue }
        type.value = ''
        illnessType.value = ''
        depId.value = ''
        patientId.value = ''
    }

    return { illnessInfo, type, illnessType, depId, patientId, clear }
}, {
    unistorage: true
})